package com.lemontree.springmvc.filter;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;

/**
 * @Author: YLBG-YCY-1325
 * @Description:
 * @Date: 2017/9/4
 */
public class MyFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("---------------------初始化过滤器-----------------");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
            FilterChain filterChain) throws IOException, ServletException {
        System.out.println("before-------------");
        filterChain.doFilter(servletRequest,servletResponse);
        System.out.println("after--------------");
    }

    @Override
    public void destroy() {
        System.out.println("销毁过滤器");
    }
}
